<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:72:"D:\Apache24\htdocs\chenxiangyu/application/ebcms\view\manager\index.html";i:1488165561;s:72:"D:\Apache24\htdocs\chenxiangyu/application/ebcms\view\common\header.html";i:1488098063;s:72:"D:\Apache24\htdocs\chenxiangyu/application/ebcms\view\common\footer.html";i:1482201112;}*/ ?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <title>后台管理系统</title>
    <script type="text/javascript" src="__ROOT__/system/js/jquery.min.js"></script>
    <!-- Bootstrap -->
    <link href="__ROOT__/third/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <!-- HTML5 Shim and Respond.js IE8 flowers of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]]
    <script src="http://static.ebcms.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://static.ebcms.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="__ROOT__/third/bootstrap/js/bootstrap.min.js"></script>
    <!-- artDialog -->
    <script type="text/javascript" src="__ROOT__/third/artDialog/jquery.artDialog.js"></script>
    <link rel="stylesheet" type="text/css" href="__ROOT__/third/artDialog/skins/default.css">
    <script type="text/javascript" src="__ROOT__/third/artDialog/artDialog.ext.js"></script>
    <!-- 引入后台样式表 -->
    <link rel="stylesheet" type="text/css" href="__ROOT__/system/css/admin.css">
    <script type="text/javascript" src="__ROOT__/system/js/admin.js"></script>
    <script>
        $(function() {

            // 动作绑定
            $('.ebcms-do').bind('click', function(event) {
                var $this  = $(this);
                if ($this.attr('confirm')) {
                    EBCMS.MSG.confirm($this.attr('confirm'),function(){
                        EBCMS.CORE.do({
                            method:$this.attr('method'),
                            url:$this.attr('url'),
                            data:$this.data()
                        });
                    });
                }else{
                    EBCMS.CORE.do({
                        method:$this.attr('method'),
                        url:$this.attr('url'),
                        data:$this.data()
                    });
                }
            });
            $('.ebcms-go').bind('click', function(event) {
                var $this  = $(this);
                if ($this.attr('confirm')) {
                    EBCMS.MSG.confirm($this.attr('confirm'),function(){
                        location.href=$this.attr('url');
                    });
                }else{
                    location.href=$this.attr('url');
                }
            });
            $('.ebcms-change').each(function(index, el) {
                $(this).data('value',$(this).val());
            });
            $('.ebcms-refresh').bind('click', function(event) {
                location = location;
                return false;
            });
            $('.ebcms-overflow').each(function(index, el) {
                $(this).width($(this).parent().width()-10);
            });
            $('.ebcms-overflow').bind('dblclick', function(event) {
                if ($(this).width() < 200) {
                    var maxwidth = $(window).width()/2;
                    art.dialog({
                        id:'tips',
                        title:'信息预览',
                        lock: false,
                        fixed: false,
                        drag: true,
                    }).content('<div style="max-width:'+maxwidth+'px;">'+$(this).html()+'</div>').show();
                }else{
                    if ($(this).css('overflow') == 'auto') {
                        $(this).css({
                            'overflow': 'hidden',
                            'white-space': 'nowrap'
                        });
                    }else{
                        $(this).css({
                            'overflow': 'auto',
                            'white-space': 'normal'
                        });
                    }
                }
            });
            $('.ebcms-change').change(function() {
                var $this  = $(this);
                if ($this.attr('confirm')) {
                    EBCMS.MSG.confirm($this.attr('confirm'),function(){
                        $this.data('value', $this.val());
                        EBCMS.CORE.do({
                            url:$this.attr('url'),
                            data:$this.data()
                        });
                    },function(){
                        $this.val($this.data('value'));
                    });
                }else{
                    $this.data('value', $this.val());
                    EBCMS.CORE.do({
                        url:$this.attr('url'),
                        data:$this.data()
                    });
                }
            });
        });
    </script>
</head>
<body>
<script>
    var M = {};
    $(function() {
        M.password = function(id){
            EBCMS.MSG.confirm('<p>请输入密码：<p/><p><input type="text" class="form-control" value="'+EBCMS.FN.random_str(8,'0123456789abcdefghijklmnopqrstuvwxyz')+'" id="re_password"><p/><p><button type="button" class="btn btn-sm btn-danger" onclick="$(\'#re_password\').val(EBCMS.FN.random_str(8,\'0123456789abcdefghijklmnopqrstuvwxyz\'));">随机</button><p/>',function(){
                EBCMS.CORE.submit({
                    url:'<?php echo url('password'); ?>',
                    queryParams:{
                        id:id,
                        password:$('#re_password').val()
                    },
                    success:function(res){
                        if (!res.code) {
                            EBCMS.MSG.alert(res.msg);
                        }else{
                            EBCMS.MSG.notice(res.msg);
                        };
                    }
                });
            });
        }
    });
</script>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <h3>
                <span>账户管理</span>
                <a href="<?php echo url('add'); ?>"><span class="glyphicon glyphicon-plus"></span></a>
            </h3>
            <div class="table-responsive">
                <table class="table table-bordered table-hover table-ebcms">
                    <tbody>
                        <tr>
                            <th style="width:70px;">id</th>
                            <th style="width:130px;">操作</th>
                            <th style="width:170px;">处理</th>
                            <th>昵称</th>
                            <th>邮箱</th>
                            <th>角色</th>
                        </tr>
                        <?php 
                            $data = \app\ebcms\model\Manager::order('sort desc,id asc') -> select();
                         if(is_array($data) || $data instanceof \think\Collection): if( count($data)==0 ) : echo "" ;else: foreach($data as $key=>$vo): ?>
                            <tr>
                                <td><?php echo $vo['id']; ?></td>
                                <td>
                                    <?php if(check_auth('status') && config('super_admin')!=$vo['email']): if($vo['status'] == '1'): ?>
                                        <button type="button" class="btn btn-primary btn-sm ebcms-do" url="<?php echo url('status'); ?>" data-id='<?php echo $vo['id']; ?>' data-value='0'><span class="glyphicon glyphicon-ok-sign"></span></button>
                                        <?php else: ?>
                                        <button type="button" class="btn btn-warning btn-sm ebcms-do" url="<?php echo url('status'); ?>" data-id='<?php echo $vo['id']; ?>' data-value='1'><span class="glyphicon glyphicon-ban-circle"></span></button>
                                        <?php endif; endif; if(check_auth('edit')): ?>
                                        <a href="<?php echo url('chenxiangy/manger/edit',['id'=>$vo['id']]); ?>" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-pencil"></span></a>
                                    <?php endif; if(check_auth('delete') && config('super_admin')!=$vo['email']): ?>
                                        <button type="button" class="btn btn-primary btn-sm ebcms-do" url="<?php echo url('delete'); ?>" data-id='<?php echo $vo['id']; ?>' confirm="删除后不可恢复，确定删除？"><span class="glyphicon glyphicon-remove"></span></button>
                                    <?php endif; ?>
                                </td>
                                <td>
                                    <?php if(check_auth('group') && config('super_admin')!=$vo['email']): ?>
                                        <a href="<?php echo url('chenxiangy/manger/group',['id'=>$vo['id']]); ?>" class="btn btn-primary btn-sm">分配角色</a>
                                    <?php endif; if(check_auth('password') && config('super_admin')!=$vo['email']): ?>
                                        <button onclick="M.password('<?php echo $vo['id']; ?>');" type="button" class="btn btn-primary btn-sm">重置密码</button>
                                    <?php endif; ?>
                                </td>
                                <td><?php echo $vo['nickname']; ?></td>
                                <td><?php echo $vo['email']; ?></td>
                                <td>
                                    <?php if(is_array($vo['group']) || $vo['group'] instanceof \think\Collection): if( count($vo['group'])==0 ) : echo "" ;else: foreach($vo['group'] as $key=>$v): ?>
                                        <span><?php echo $v['title']; ?></span>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </td>
                            </tr>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
</body>
</html>